package com.vvvtimes.demo.controller;

import com.vvvtimes.demo.common.dto.RestResponse;
import com.vvvtimes.demo.domain.dto.DigestDTO;
import com.vvvtimes.demo.service.DigestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/digest")
public class DigestController {

    @Autowired
    private DigestService digestService;

    @RequestMapping(value = "/md5", method = {RequestMethod.POST, RequestMethod.GET})
    public RestResponse<String> md5(@RequestBody DigestDTO digestDTO) {
        return digestService.md5(digestDTO);
    }


    @RequestMapping(value = "/sha1", method = {RequestMethod.POST, RequestMethod.GET})
    public RestResponse<String> sha1(@RequestBody DigestDTO digestDTO) {
        return digestService.sha1(digestDTO);
    }
}

